package cn.com.oceansoft.business.mobile.danger.entity;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;


/**
 * 微信通用接口凭证
 */
public class AccessToken {
	// 商家id
	private Long mer_id;
	// 固定凭证
	private String token;
	// 获取到的凭证
	private String access_token;
	// 凭证有效时间 
	private long expires ;
	
	private String appid;
	
	private String appsecret;
	
	private String openid;
	
	
	public static RowMapper<AccessToken> getFullMapp() {
        return new RowMapper<AccessToken>() {
            @Override
            public AccessToken mapRow(ResultSet rs, int rowNum) throws SQLException {
            	AccessToken obj = new AccessToken();
            	obj.setMer_id(rs.getLong("mer_id"));
            	obj.setToken(rs.getString("token"));
            	obj.setAccess_token(rs.getString("access_token"));
            	obj.setExpires(rs.getLong("expires"));
            	obj.setAppid(rs.getString("appid"));
            	obj.setAppsecret(rs.getString("appsecret"));
                return obj;
            }
        };
    }
	
	public static RowMapper<AccessToken> getMapp() {
        return new RowMapper<AccessToken>() {
            @Override
            public AccessToken mapRow(ResultSet rs, int rowNum) throws SQLException {
            	AccessToken obj = new AccessToken();
            	obj.setMer_id(rs.getLong("mer_id"));
            	obj.setToken(rs.getString("token"));
            	obj.setAccess_token(rs.getString("access_token"));
            	obj.setExpires(rs.getLong("expires"));
            	obj.setAppid(rs.getString("appid"));
            	obj.setAppsecret(rs.getString("appsecret"));
            	obj.setOpenid(rs.getString("openid"));
                return obj;
            }
        };
    }
	
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public String getAccess_token() {
		return access_token;
	}

	public void setAccess_token(String access_token) {
		this.access_token = access_token;
	}

	public AccessToken() {
		super();
	}
	public AccessToken(Long mer_id, String token) {
		super();
		this.mer_id = mer_id;
		this.token = token;
	}
	
	public AccessToken(Long mer_id, String token, long expires) {
		super();
		this.mer_id = mer_id;
		this.token = token;
		this.expires = expires;
	}
	
	
	public AccessToken(Long mer_id, String token, String access_token,
			long expires) {
		super();
		this.mer_id = mer_id;
		this.token = token;
		this.access_token = access_token;
		this.expires = expires;
	}

	public Long getMer_id() {
		return mer_id;
	}
	public void setMer_id(Long mer_id) {
		this.mer_id = mer_id;
	}
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
	
	public long getExpires() {
		return expires;
	}
	public void setExpires(long expires) {
		this.expires = expires;
	}
	public String getAppid() {
		return appid;
	}
	public void setAppid(String appid) {
		this.appid = appid;
	}
	public String getAppsecret() {
		return appsecret;
	}
	public void setAppsecret(String appsecret) {
		this.appsecret = appsecret;
	}
	
	
	
}
